package com.metagurukul.metaspace.service;

import java.sql.SQLException;
import java.util.List;

import com.metagurukul.metaspace.dao.DepartmentDao;
import com.metagurukul.metaspace.dao.ProjectDao;
import com.metagurukul.metaspace.dao.RoleDao;
import com.metagurukul.metaspace.models.beans.Department;
import com.metagurukul.metaspace.models.beans.Project;
import com.metagurukul.metaspace.models.beans.Role;

/**
 * @author Nikku
 * 
 */
public final class WorkDetailService {

	/**
	 * Private Constructor because the class has static methods
	 */
	private WorkDetailService() {
	}

	/**
	 * @return list of all available departments in the orgainzation
	 * @throws SQLException
	 */
	public static List<Department> getDepartmentList() throws SQLException {
		DepartmentDao departmentDao = new DepartmentDao();
		return departmentDao.getRecordList();
	}

	/**
	 * @return list of all available roles in the organization
	 * @throws SQLException
	 */
	public static List<Role> getRoleList() throws SQLException {
		RoleDao roleDao = new RoleDao();
		return roleDao.getRecordList();
	}

	/**
	 * @return list of all projects that the organization is working on
	 * @throws SQLException
	 */
	public static List<Project> getProjectList() throws SQLException {
		ProjectDao projectDao = new ProjectDao();
		return projectDao.getRecordList();
	}

	/**
	 * @param deptId department id 
	 * @return name of department
	 * @throws SQLException
	 */
	public static String getDepartmentName(int deptId) throws SQLException {
		DepartmentDao departmentDao = new DepartmentDao();
		return departmentDao.getName(deptId);

	}

	/**
	 * @param roleId role id 
	 * @return
	 * @throws SQLException
	 */
	public static String getRoleName(int roleId) throws SQLException {
		DepartmentDao departmentDao = new DepartmentDao();
		return departmentDao.getName(roleId);

	}

	/**
	 * @param projectId project id
	 * @return name of project
	 * @throws SQLException
	 */
	public static String getProjectName(int projectId) throws SQLException {
		DepartmentDao departmentDao = new DepartmentDao();
		return departmentDao.getName(projectId);
	}
}
